<%@page contentType="text/html; charset=UTF-8" language="java" %>
<html>
<head>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script>
        $(function () {
            $("#uploadInput").on("change",function () {
                console.log(this.files[0]);
                $("#img").attr("src",window.URL.createObjectURL(this.files[0]));
            });
        });
    </script>
</head>
<body>

<h2>file upload</h2>

<form action="${pageContext.request.contextPath}/uploadFile" enctype="multipart/form-data" method="post">
    上传：<input type="file" name="file" id="uploadInput"><br/>
    <input type="submit" value="upload">
</form>
<%--图片预览--%>
<img id="img" style="width: 100px;height: 80px;" />


</body>
</html>
